package cn.wolfcode.trip.app.web.controller;


import cn.wolfcode.trip.base.domain.TravelConcern;
import cn.wolfcode.trip.base.service.ITravelConcernService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/travelConcerns")
@Controller
//游记的点赞和收藏接口
public class TravelConcernController {

    @Autowired
    private ITravelConcernService travelConcernService;

    //游记收藏记录的添加
    @PostMapping("/Collector")
    @ResponseBody
    public Object saveCollector(TravelConcern travelConcern){
        System.out.println("11111");
        travelConcernService.saveCollector(travelConcern);
        return new JSONResult();
    }

    //游记收藏记录的取消
    @PutMapping("/Collector")
    @ResponseBody
    public Object updateCollector(TravelConcern travelConcern){
        travelConcernService.updateCollector(travelConcern);
        return new JSONResult();
    }


    //游记点赞记录的添加
    @PostMapping
    @ResponseBody
    public Object save(TravelConcern travelConcern){
        travelConcernService.save(travelConcern);
        return new JSONResult();
    }

    //游记点赞记录的取消
    @PutMapping
    @ResponseBody
    public Object update(TravelConcern travelConcern){
        travelConcernService.update(travelConcern);
        return new JSONResult();
    }



}
